from pydocx import PyDocX
import html2text as ht

html = PyDocX.to_html(r"TestPostAPI.docx")
f = open("test.html", 'w', encoding="utf-8")
f.write(html)
f.close()

text_maker = ht.HTML2Text()
text_maker.bypass_tables = False
path =r"test.html"
htmlfile = open(path,'r',encoding='UTF-8')
htmlpage = htmlfile.read()
text = text_maker.handle(htmlpage)
md = text.split('#')
open("test.md","w").write(md[0])
